package com.ruoyi.ring.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ring.domain.UserPhysiologySet;
import com.ruoyi.ring.mapper.UserPhysiologySetMapper;
import com.ruoyi.ring.service.IUserPhysiologySetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 生理周期设置Service业务层处理
 * 
 * @author liuwp
 * @date 2025-09-30
 */
@Service
public class UserPhysiologySetServiceImpl implements IUserPhysiologySetService 
{
    @Autowired
    private UserPhysiologySetMapper userPhysiologySetMapper;

    /**
     * 查询生理周期设置
     * 
     * @param id 生理周期设置主键
     * @return 生理周期设置
     */
    @Override
    public UserPhysiologySet selectUserPhysiologySetById(Long id)
    {
        return userPhysiologySetMapper.selectUserPhysiologySetById(id);
    }

    /**
     * 查询生理周期设置列表
     * 
     * @param userPhysiologySet 生理周期设置
     * @return 生理周期设置
     */
    @Override
    public List<UserPhysiologySet> selectUserPhysiologySetList(UserPhysiologySet userPhysiologySet)
    {
        return userPhysiologySetMapper.selectUserPhysiologySetList(userPhysiologySet);
    }

    /**
     * 根据业务主键查询一条记录：生理周期设置
     *
     * @param userPhysiologySet 生理周期设置
     * @return 生理周期设置
     */
    @Override
    public UserPhysiologySet selectOneUserPhysiologySet(UserPhysiologySet userPhysiologySet)
    {
        return userPhysiologySetMapper.selectOneUserPhysiologySet(userPhysiologySet);
    }

    /**
     * 新增生理周期设置
     * 
     * @param userPhysiologySet 生理周期设置
     * @return 结果
     */
    @Override
    public int insertUserPhysiologySet(UserPhysiologySet userPhysiologySet)
    {
        userPhysiologySet.setUserId(SecurityUtils.getUserId());
        userPhysiologySet.setCreateTime(DateUtils.getNowDate());
        return userPhysiologySetMapper.insertUserPhysiologySet(userPhysiologySet);
    }

    /**
     * 修改生理周期设置
     * 
     * @param userPhysiologySet 生理周期设置
     * @return 结果
     */
    @Override
    public int updateUserPhysiologySet(UserPhysiologySet userPhysiologySet)
    {
        userPhysiologySet.setUpdateTime(DateUtils.getNowDate());
        return userPhysiologySetMapper.updateUserPhysiologySet(userPhysiologySet);
    }

    @Override
    public int updateUserPhysiologySetCondition(UserPhysiologySet userPhysiologySet, UserPhysiologySet userPhysiologySetCondition)
    {
                userPhysiologySet.setUpdateTime(DateUtils.getNowDate());
        return userPhysiologySetMapper.updateUserPhysiologySetCondition(userPhysiologySet, userPhysiologySetCondition);
    }

    /**
     * 批量删除生理周期设置
     * 
     * @param ids 需要删除的生理周期设置主键
     * @return 结果
     */
    @Override
    public int deleteUserPhysiologySetByIds(Long[] ids)
    {
        return userPhysiologySetMapper.deleteUserPhysiologySetByIds(ids);
    }

    /**
     * 删除生理周期设置信息
     * 
     * @param id 生理周期设置主键
     * @return 结果
     */
    @Override
    public int deleteUserPhysiologySetById(Long id)
    {
        return userPhysiologySetMapper.deleteUserPhysiologySetById(id);
    }

    /**
     * 条件删除生理周期设置
     *
     * @param userPhysiologySet 生理周期设置
     * @return 结果
     */
    @Override
    public int deleteUserPhysiologySetByCondition(UserPhysiologySet userPhysiologySet)
    {
        return userPhysiologySetMapper.deleteUserPhysiologySetByCondition(userPhysiologySet);
    }

}
